home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / AppMaker 2.0b3 / Demo AppMaker 1.5 / Demo AppMaker™ / Demo AppMaker™.rsrc / TmCT_302_zApp < prev    next >
Encoding:
Text File  |  1992-04-08  |  3.0 KB  |  129 lines

  1. /* %filename% -- application methods */
  2. /* Created %date% %time% by AppMaker */
  3.  
  4. /*    We recommend that you not modify this module and instead modify        */
  5. /*    its subclass, %Appname%App.  The 'z' prefix on this module marks%    %*/
  6. /*    a module which is likely to be regenerated by AppMaker after you    */
  7. /*    make changes to the user interface.  The modules without the 'z'    */
  8. /*    prefix will not be regenerated by AppMaker unless you delete them.    */
  9. /*    Using a separate subclass to override the AppMaker-generated code    */
  10. /*    lets you regenerate code without losing your hand-coded changes.    */ 
  11.  
  12. #include <Commands.h>
  13. #include <Global.h>
  14. #include <CBartender.h>
  15. #include <CFWDesktop.h>
  16. #include <CWindow.h>
  17. #include "ResourceDefs.h"
  18. %for each menu gen includeAppDialogs%
  19. #include "%Appname%Doc.h"
  20. #include "z%Appname%App.h"
  21.  
  22. extern OSType             gSignature;
  23. extern CBartender        *gBartender;
  24. extern CDesktop            *gDesktop;
  25.  
  26. #define kExtraMasters        4
  27. #define kRainyDayFund        20480
  28. #define kCriticalBalance    20480
  29. #define kToolboxBalance        20480
  30.  
  31. /*----------*/
  32. void    Z%Appname%App::I%Appname%App    (void)
  33. {
  34.     inherited::IApplication (kExtraMasters, kRainyDayFund,
  35.                                     kCriticalBalance, kToolboxBalance);
  36.  
  37.     %for each dialog gen createModeless%
  38.  
  39. } /* I%Appname%App */
  40.  
  41. /*----------*/
  42. void    Z%Appname%App::MakeDesktop    (void)
  43. {
  44.     gDesktop = new CFWDesktop;
  45.     ((CFWDesktop *)gDesktop)->IFWDesktop (this);
  46.  
  47. } /* MakeDesktop */    
  48.  
  49. /*----------*/
  50. void    Z%Appname%App::SetUpMenus    (void)
  51. {
  52.     MenuHandle        macMenu;
  53.  
  54.     inherited::SetUpMenus ();
  55.     %for each menu gen setup%
  56.  
  57.     %for each menu gen addPopup%
  58.  
  59. } /* SetUpMenus */
  60.  
  61. /*----------*/
  62. void    Z%Appname%App::CreateDocument    (void)
  63. {
  64.     C%Appname%Doc        *theDocument;
  65.  
  66.     theDocument = NULL;
  67.     TRY {
  68.         theDocument = new C%Appname%Doc;
  69.         theDocument->I%Appname%Doc (this, TRUE);
  70.         theDocument->NewFile ();
  71.     } CATCH {
  72.         ForgetObject (theDocument);
  73.     } ENDTRY;
  74.  
  75. } /* CreateDocument */
  76.  
  77. /*----------*/
  78. void    Z%Appname%App::OpenDocument    (SFReply    *macSFReply)
  79. {
  80.     C%Appname%Doc        *theDocument;
  81.  
  82.     theDocument = NULL;
  83.     TRY {
  84.         theDocument = new C%Appname%Doc;
  85.         theDocument->I%Appname%Doc (this, TRUE);
  86.         theDocument->OpenFile (macSFReply);
  87.     } CATCH {
  88.         ForgetObject (theDocument);
  89.     } ENDTRY;
  90.  
  91. } /* OpenDocument */
  92.  
  93. %if fileExists appname+App.c%
  94.     /*----------*/
  95.     /* This code should be in %Appname%App.c rather than in this file. */
  96.     /* AppMaker generated it here because %Appname%App.c already existed. */
  97.     /* AppMaker doesn't overwrite an existing non-Z file because it */
  98.     /* might have lots of user hand-written code. */
  99.     /*----------*/
  100.     void    Z%Appname%App::UpdateMenus        (void)
  101.     {
  102.         inherited::UpdateMenus ();
  103.         %for each menu gen updateAppMenus%
  104.     
  105.     } /* UpdateMenus */
  106.  
  107. %endif%
  108. /*----------*/
  109. void    Z%Appname%App::DoCommand    (long        theCommand)
  110. {
  111.     short            itemNr;
  112.  
  113.     switch (theCommand) {
  114.         case cmdAbout:
  115.                 itemNr = Alert (1, NULL);
  116.             break;
  117.         %if fileExists appname+App.c%
  118.             %for each menu gen handleAppItems%
  119.         %endif%
  120.  
  121.         default:
  122.                 inherited::DoCommand (theCommand);
  123.             break;
  124.     } /* switch */
  125.  
  126. } /* DoCommand */
  127.  
  128. /* %filename% */
  129.